Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#75 add ExtOrigin config to handle lfs-test-server behind a reverse proxy case #110

Merged
merged 6 commits into from
Oct 12, 2022

Conversation

leyuanpanbluvec
Copy link

As described in #75, when the lfs-test-server is behind a reverse proxy, the LFS_HOST will not denote the external link correctly. For example, the external link is https://git-lfs.example.com served by nginx, the LFS_LISTEN is tcp://localhost:1234 and LFS_SCHEME is http. Whatever LFS_HOST is set, the external URL is incorrect.
I added additional config, i.e., LFS_EXTORIGIN, which is blank by default. If it is blank, the old method will be used to denote the external origin, as follows:

if Config.IsHTTPS() {
	Config.ExtOrigin = fmt.Sprintf("%s://%s", Config.Scheme, Config.Host)
} else {
	Config.ExtOrigin = fmt.Sprintf("http://%s", Config.Host)
}

However, when the user set LFS_EXTORIGIN, it will be used to skip the old setting, e.g., LFS_EXTORIGIN='https://git-lfs.example.com'.

By the way, why not use Config.ExtOrigin = fmt.Sprintf("%s://%s", Config.Scheme, Config.Host) to replace the above old external link generation method?

Copy link
Member

@chrisd8088 chrisd8088 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I made a couple of small comments only. If you want to add some additional commits to address those, that's great, and if not, I'll merge this as it stands.

mgmt/templates/config.tmpl Outdated Show resolved Hide resolved
config.go Outdated Show resolved Hide resolved
@chrisd8088 chrisd8088 merged commit 24ca93f into git-lfs:main Oct 12, 2022
@chrisd8088
Copy link
Member

Looks great, thank you for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants